import type { Reactive } from "vue"
function sortMenuTreeFunc(menuTreeData:Reactive<Array<UserType.MenuInfo>>):Array<UserType.MenuInfo> {
 return menuTreeData.sort((a,b)=>{
    return b.level-a.level
  }).map((menuItem,index)=>{
    if(menuItem.children&&menuItem.children.length>0){
      menuItem.children=  sortMenuTreeFunc(menuItem.children) 
    }
    return menuItem
  })
}
export default function useMenu(menuTreeList:Array<UserType.MenuInfo>){

  
//菜单排序


 return {
  sortMenuTreeData:sortMenuTreeFunc(menuTreeList)
 }

}